package com.ruoyi.security.service.craw.impl;

import com.ruoyi.security.constant.ApiConstant;
import com.ruoyi.security.service.craw.ICrawSecurityTradingCalendarService;
import com.ruoyi.security.vo.SecurityTradingCalendarResponse;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.http.HttpUtils;

/**
 * 证券交易日历爬取服务实现类
 * 
 * @author yeoman
 * @date 2025-01-15
 */
@Slf4j
@Service
public class CrawSecurityTradingCalendarServiceImpl implements ICrawSecurityTradingCalendarService {

    @Override
    public SecurityTradingCalendarResponse craw(Integer year, Integer month) {
        return doCraw(year, month);
    }
    

    private SecurityTradingCalendarResponse doCraw(Integer year, Integer month) {
        String response = HttpUtils.sendGet(String.format(ApiConstant.SZSE_TRADING_CALENDAR_URL, year + "-" + month));
        return JSON.parseObject(response, SecurityTradingCalendarResponse.class);
    }
    
    
   
}
